package UseString.demo04;

public class Practice05 {
    public static void main(String[] args) {
        /* 给定两个字符串形式表示的非负整数num1和非负整数num2的乘积，他们的乘积也表示为字符串形式
        注意：需要用已有的知识完成
        */
        String num1 = "12344";
        String num2 = "23456";

        int result1 = changeNum(num1);
        int result2 = changeNum(num2);
        System.out.println(result1*result2);

    }
    public static int changeNum(String num){
        char[] c = num.toCharArray();
        int sum = 0;
        for (int i = 0; i < c.length; i++) {
            int n = c[i] -48;
            sum = sum + n * calculate(c.length -1 -i);
        }
        return sum;
    }
    public static int calculate(int n){
        int sum = 1;
        for (int i = 0; i < n; i++) {
            sum = sum *10;
        }
        return sum;
    }
}
